<template>
	<el-dialog v-model="visible" title="${tableComment}详情" width="<#if formLayout == 2>950px<#else>500px</#if>" draggable>
		<el-descriptions :column="${formLayout?number}">
			<#list formList as field>
			<#if field.formDict??>
			<el-descriptions-item label="${field.fieldComment}">{{ detailForm.${field.attrName}Label }}</el-descriptions-item>
			<#else>
			<el-descriptions-item label="${field.fieldComment}">{{ detailForm.${field.attrName} }}</el-descriptions-item>
			</#if>
			</#list>
		</el-descriptions>
	</el-dialog>
</template>

<script setup lang="ts">
import { reactive, ref } from 'vue'
import { use${FunctionName}Api } from '@/api/${moduleName}/${functionName}'

const visible = ref(false)

const detailForm = reactive({
	<#list formList as field>
	<#if field.formDict??>
	${field.attrName}Label: null,
	</#if>
	${field.attrName}: null<#sep>,</#sep>
	</#list>
})

const init = (id: number) => {
	visible.value = true
	get${FunctionName}(id)
}

/**
 * @description	: 根据id查询详情
 * @param				 {*} id: 唯一标识符
 * @return				{*}
 */
const get${FunctionName} = (id: number) => {
	use${FunctionName}Api(id).then((res: any) => {
		Object.assign(detailForm, res.data)
	})
}

defineExpose({
	init
})
</script>
